package com.sifang.POI.dianping;

public class GoCommand implements Command {

	private int maxThreads;
	private int cityId;

	public GoCommand(int cityId, int maxThreads) {
		this.setCityId(cityId);
		this.setMaxThreads(maxThreads);
	}

	public GoCommand(int cityId) {
		this(cityId, MultiThreadsCommand.DEFAULT_MAX_THREADS);
	}

	public int getCityId() {
		return cityId;
	}

	public void setCityId(int cityId) {
		this.cityId = cityId;
	}

	public int getMaxThreads() {
		return maxThreads;
	}

	public void setMaxThreads(int maxThreads) {
		this.maxThreads = maxThreads;
	}
	
	@Override
	public void execute() throws Exception {
		new AddCityCommand(getCityId()).execute();
		new PreJobCommand(getMaxThreads()).execute();
		new JobCommand(getMaxThreads()).execute();
		new AddDetailCommand(getMaxThreads()).execute();
		new AddDistrictCommand(getCityId()).execute();
		new AddCategoryRegionCommand(getCityId()).execute();
	}
	
	/**
	 * @param args
	 * @throws Exception 
	 */
	public static void main(String[] args) throws Exception {
		new GoCommand(288).execute();
	}

}
